Terminate a While/Do/For loop.
ExitLoop [level]
Parameters
level | [optional] The number of loop levels to exit from. The default is 1 (meaning the current loop). |
Remarks
A negative level or zero value has no effect.
Related
ContinueLoop, Exit, For, Do, While
Example
$sum = 0
While 1 ;use infinite loop since ExitLoop will get called
$ans = InputBox("Running total=" & $sum, _
" Enter a positive number. (A negative number exits)")
If $ans < 0 Then ExitLoop
$sum = $sum + $ans
WEnd
MsgBox(0,"The sum was", $sum)